package cn.school.test;

import cn.school.dao.StudentDao;
import cn.school.entity.Student;
import cn.school.util.MyBatisUtil;
import org.apache.ibatis.session.SqlSession;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @author oldliu
 * @since 1.0
 */
public class SearchByDate {
    public static void main(String[] args) throws ParseException {
        SimpleDateFormat df=new SimpleDateFormat("yyyy-MM-dd");
        SqlSession s= MyBatisUtil.get();
        StudentDao mapper = s.getMapper(StudentDao.class);
        Map<String,Object>p=new HashMap<>();
        p.put("sname","李");
        p.put("start",df.parse("2017-1-1"));
        p.put("end",df.parse("2019-12-1"));
        List<Student> students = mapper.search2(2, 5, p);
        students.stream().forEach(System.out::println);
        MyBatisUtil.close(s);
    }
}
